package com.itheima.stock.controller;

import com.itheima.stock.service.UserService;
import com.itheima.stock.vo.rep.LoginReqVo;
import com.itheima.stock.vo.resp.LoginRespVo;
import com.itheima.stock.vo.resp.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/api")
public class UserController {
//    @GetMapping("test")
//    public String test(){
//        return "itheima";
//    }

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public R<LoginRespVo> longin(@RequestBody LoginReqVo vo){
        return userService.login(vo);
    }

    /*
    * 生成登录效验码
    * */
    @GetMapping("/captcha")
    public R<Map> genCaptchaCode(){
        return userService.genCaptchaCode();
    }
}
